import 'package:ecy_app_flutter/EcyRouter.dart';
import 'package:ecy_app_flutter/main.dart';
import 'package:ecy_app_flutter/routes/blind_box/blind_box_enter.dart';
import 'package:ecy_app_flutter/routes/blind_box/blind_box_myAssets.dart';
import 'package:ecy_app_flutter/routes/mainTabPage.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class BlindBoxSuccessPage extends StatelessWidget {
  const BlindBoxSuccessPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: const Color(0xFFF5F5F5),
      appBar: AppBar(
        backgroundColor: Colors.transparent,
        elevation: 0,
        leading: IconButton(
          icon: const Icon(Icons.arrow_back_ios, color: Colors.black),
          onPressed: () => Navigator.of(context).pop(),
        ),
      ),
      body: Center(
        child: Container(
          width: 320.w,
          padding: EdgeInsets.symmetric(vertical: 32.h, horizontal: 16.w),
          decoration: BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.circular(16),
          ),
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              Container(
                width: 64.w,
                height: 64.w,
                decoration: BoxDecoration(
                  color: Color(0xFFFFE6F1),
                  shape: BoxShape.circle,
                ),
                child: Center(
                  child: Icon(Icons.check_circle, color: Color(0xFFFF3E9F), size: 48.w),
                ),
              ),
              SizedBox(height: 24.h),
              Text(
                '上架成功!',
                style: TextStyle(
                  fontSize: 22.sp,
                  fontWeight: FontWeight.bold,
                  color: Color(0xFF222222),
                ),
              ),
              SizedBox(height: 8.h),
              Text(
                '您的商品已成功上架互换集市，快去看看吧~',
                style: TextStyle(
                  fontSize: 14.sp,
                  color: Color(0xFF888888),
                ),
                textAlign: TextAlign.center,
              ),
              SizedBox(height: 32.h),
              SizedBox(
                width: double.infinity,
                height: 44.h,
                child: ElevatedButton(
                  onPressed: () {
                    Navigator.of(context).pushAndRemoveUntil(
                      MaterialPageRoute(
                        builder: (context) => BlindBoxEnter(key: const Key("blindBoxEnter"), commodityName: "", ipCode: "",initialCommodityId: "",ipName: ""),
                      ),
                      (route) => route.isFirst,
                    );
                  },
                  style: ElevatedButton.styleFrom(
                    backgroundColor: Color(0xFFFF3E9F),
                    shape: RoundedRectangleBorder(
                      borderRadius: BorderRadius.circular(24),
                    ),
                  ),
                  child: Text('去互换集市', style: TextStyle(fontSize: 16.sp, color: Colors.white)),
                ),
              ),
              SizedBox(height: 16.h),
              SizedBox(
                width: double.infinity,
                height: 44.h,
                child: OutlinedButton(
                  onPressed: () {
                    Navigator.of(context).pushAndRemoveUntil(
                      MaterialPageRoute(
                        builder: (context) => BlindBoxMyAssets(),
                      ),
                      (route) => route.isFirst,
                    );
                  },
                  style: OutlinedButton.styleFrom(
                    side: BorderSide(color: Color(0xFFFF3E9F)),
                    shape: RoundedRectangleBorder(
                      borderRadius: BorderRadius.circular(24),
                    ),
                  ),
                  child: Text('返回痛柜', style: TextStyle(fontSize: 16.sp, color: Color(0xFFFF3E9F))),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
} 